﻿using TMPro;
using UnityEngine;

namespace Yoozoo.Gameplay.RTS
{
    public class MonsterHudLod0 : MonoBehaviour
    {
        public SpriteRenderer bg;
        public SpriteRenderer LevelBg;
        public TMP_Text LevelText;
        private string _bgName = string.Empty;
        private Color textColor;


        public void SetBgIcon(string name)
        {
            ArmyManager.Instance.ResourceManager.SetHeroRtsAtlasIcon(name,bg);
        }
        
        public void SetLohaBgIcon(string name)
        {
            ArmyManager.Instance.ResourceManager.SetMapElementAtlasIcon(name,LevelBg);
        }
        public void SetLevelBg(string bgName)
        {
            if (!string.IsNullOrEmpty(bgName) && _bgName != bgName)
            {
                _bgName = bgName;
                ArmyManager.Instance.ResourceManager.SetMapElementAtlasIcon(bgName, LevelBg);
            }
        }
        public void SetRtsLevelBg(string bgName)
        {
            if (!string.IsNullOrEmpty(bgName) && _bgName != bgName)
            {
                _bgName = bgName;
                ArmyManager.Instance.ResourceManager.SetWorldmapAtlasIcon(bgName, LevelBg);
            }
        }
        public void SetLevelTextColor(Color color)
        {
            if (LevelText!=null)
            {
                if (textColor != color)
                {
                    textColor = color;
                    LevelText.color = color;
                }
            }
        }

        public void Dispose()
        {
            _bgName = string.Empty;
        }
    }
}
